package rm.ep.shared;


import com.googlecode.objectify.annotation.Unindexed;

@SuppressWarnings("serial")
public class EnquiryEntity extends AbstractEntity {

	private String fType;
	
	@Unindexed 
	private String fEmail;
	
	@Unindexed 
	private String fDetail;

	private Boolean fIsActive;
	
	protected EnquiryEntity() {
		// required empty constructor
	}
	
	public EnquiryEntity(String type, String email, String detail) {
		if (type == null || type.length() < 3) {
			throw new IllegalArgumentException("Invalid type: >3chars");
		}
		fType = type.toUpperCase();
		if (email == null || !Validator.isEmail(email.toUpperCase())) {
			throw new IllegalArgumentException("Invalid email");
		}
		fEmail = email.toLowerCase();
		if (detail == null || detail.length() < 50) {
			throw new IllegalArgumentException("Invalid detail: > 50chars");
		}
		fIsActive = Boolean.FALSE;
		fDetail = detail;
	}
	
	public String getType() {
		return fType;
	}
	
	public String getEmail() {
		return fEmail;
	}
	
	public String getDetail() {
		return fDetail;
	}
	
	public Boolean isActive() {
		return fIsActive;
	}
	
	public void setActive(Boolean isActive) {
		fIsActive = isActive;
	}
	
}
